package as.action;

import java.util.HashMap;

import org.apache.struts2.ServletActionContext;

import org.springframework.web.struts.ActionSupport;

import com.opensymphony.xwork2.ActionContext;

public abstract class BaseAction extends ActionSupport {
	/*
	 * public static final String UserKey = "UserSession"; public static final
	 * String IDKey = "IDSession";
	 */

	public static final String SUCCESS = "success";
	public static final String ERROR = "error";
	public static final String INPUT = "input";
	public static final String LOGIN = "login";

	public static final String HTTP_GET = "GET";
	public static final String HTTP_POST = "POST";

	public final String httpMethod() {
		return ServletActionContext.getRequest().getMethod();
	}

	protected void addError(String errorName, String errorMsg) {
		this.errors.put(errorName, errorMsg);
	}

	private HashMap<String, String> errors = new HashMap<String, String>();

	public HashMap<String, String> getErrors() {
		return errors;
	}

	public String getUser() {
		return (String) ActionContext.getContext().getSession().get("user");

	}

}
